import request from '../request.ts'

// 开始考试会话
export const startExamSession = (data) => {
  return request({
    url: '/exam-sessions/start',
    method: 'post',
    data
  })
}

// 保存草稿
export const saveDraft = (data) => {
  return request({
    url: '/exam-sessions/save-draft',
    method: 'post',
    data
  })
}

// 提交考试
export const submitExam = (data) => {
  return request({
    url: '/exam-sessions/submit',
    method: 'post',
    data
  })
}

// 恢复考试会话
export const resumeExamSession = (data) => {
  return request({
    url: '/exam-sessions/resume',
    method: 'post',
    data
  })
}

// 获取考试会话信息
export const getExamSession = (data) => {
  return request({
    url: '/exam-sessions/get',
    method: 'post',
    data
  })
}

// 获取考试监控数据
export const getExamMonitoring = (data) => {
  return request({
    url: '/exam-sessions/monitor',
    method: 'post',
    data
  })
}

// 记录环境信息
export const logEnvironment = (data) => {
  return request({
    url: '/exam-sessions/log-environment',
    method: 'post',
    data
  })
}

// 获取考试会话列表
export const getExamSessions = (params) => {
  return request({
    url: '/exam-sessions/list',
    method: 'get',
    params
  })
}

// 根据考试ID和学生ID获取考试会话
export const getExamSessionByExamAndStudent = (examId, studentId) => {
  return request({
    url: '/exam-sessions/get-by-exam-student',
    method: 'get',
    params: {
      examId,
      studentId
    }
  })
}
